﻿@model IEnumerable<FCNS.ERP.Models.ErpInvoice>

@{
    ViewBag.Title = "发票清单";
    Layout ="~/Views/Shared/_Layout.cshtml";
}

<h2>@ViewBag.Title</h2>
<script type="text/javascript">
    $(document).ready(function () {
        $(".KaiPiao").click(function () {
            var str = prompt("请输入发票号码");
            window.location.replace("InvoicesNO?Id=" + $(this).attr("data-Id") + "&flag=1&NO=" + str);
        });

        $(".KuaiDi").click(function () {
            var str = prompt("请输入物流单号");
            window.location.replace("InvoicesNO?Id=" + $(this).attr("data-Id") + "&flag=2&NO=" + str);
        });
    });
</script>

<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.InvoiceType)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.RelatedOrderNO)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Money)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Summary)
        </th>
        <th>
           开票日期
        </th>
        <th>
           发票号码
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Status)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.InvoiceType)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RelatedOrderNO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Money)
        </td>

        <td>
            @Html.DisplayFor(modelItem => item.Summary)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.DateTimeStart)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.OrderNO)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Status)
        </td>
        <td>
            <a href="#" class="KaiPiao" data-Id="@item.Id">开票</a>
            @if (item.Status == FCNS.ERP.Models.ErpInvoice.EnumInvoiceStatus.已开票)
           {
            <a href="#" class="KuaiDi" data-Id="@item.Id">快递</a>
           }
        </td>
    </tr>
}

</table>
